package com.guo.hui.util;


import java.lang.reflect.Type;

import com.google.gson.Gson;

public class UtilJson {

	public static String toJson(Object obj) {
		Gson gson = new Gson();
		return gson.toJson(obj);
	}

	public static <T> Object fromJson(String json, Class<T> t) {
		Gson gson = new Gson();
		return gson.fromJson(json, t);
	}

	public static <T> T fromJsonType(String json, Type t) {
		if (json == null) {
			return null;
		}
		Gson gson = new Gson();
		return gson.fromJson(json, t);
	}
	

}
